<!DOCTYPE html>
<html lang="en">
<head>
    <title>签约医院信息</title>
    <meta name="viewport" content="width=device-width,user-scalable=no, initial-scale=1">
    <titleType style="display: none">familyAdd</titleType>
    <%- include('../../_global/baseLibs') %>
</head>
<script type="text/javascript">
    $(function () {
        if(localStorage.getItem('level')){
            localStorage.removeItem('level');
        }
        //判断是否选择过医院,有则获取信息
        if(localStorage.getItem('hosInfo')){
            var obj = JSON.parse(localStorage.getItem('hosInfo'));
            $("#level1").val(obj.hosName).attr('data-id', obj.hosId);
        }
        if(localStorage.getItem('hosInfo2')){
            var obj = JSON.parse(localStorage.getItem('hosInfo2'));
            $("#level2").val(obj.hosName).attr('data-id', obj.hosId);
        }
        if(localStorage.getItem('hosInfo3')){
            var obj = JSON.parse(localStorage.getItem('hosInfo3'));
            $("#level3").val(obj.hosName).attr('data-id', obj.hosId);
        }
        //点击跳转到医院列表
        $('.info').on('click',function () {
            localStorage.setItem('level', $(this).attr("data-index"));
            location = "moreHospital.html";
        })
        $("#titleBtn").on("click", function () {
            var obj = JSON.parse(localStorage.getItem('qysq'));
            var signOrgid = $("#level1").attr("data-id");
            var signOrgidLv2 = $("#level2").attr("data-id");
            var signOrgidLv3 = $("#level3").attr("data-id");
            obj.signOrgid = signOrgid;
            obj.signOrgidLv2 = signOrgidLv2;
            obj.signOrgidLv3 = signOrgidLv3;
            if(signOrgid == "" || signOrgid == "" || signOrgid == ""){
                $.QuickAlert.alertFail({content: "还有信息未填写完整"});
                return;
            }
            apply(obj)
        });
        function apply(obj) {
            localStorage.removeItem('hosInfo');
            localStorage.removeItem('hosInfo2');
            localStorage.removeItem('hosInfo3');
            $.QuickRemote.AjaxJson({
                funcName: "/api/gzd/qyfw/apply"
                ,params: obj
                ,callback: function(result) {
                    location = "wait.html";
                }
            });
        }
    });
</script>
<body>
<section class="page-wrap page-family">
    <!-- header start -->
    <header id="header" class="header-box grey fixed"  >
        <div class="header-content">
            <div class="left-tool">
                <a class="back" href="javascript:void(0)"><i class="iconfont icon-back"></i></a>
            </div>
            <div class="title">签约医院信息</div>
        </div>
    </header>
    <!-- header end -->
    <!--content start-->
    <section class="content">
        <form id="grxxForm">
        <aside class="plane-box first family-plane">
            <ul class="default-list form-list">
                <li>
                    <div class="item-inner">
                        <div class="item-title">
                            签约医院
                        </div>
                    </div>
                </li>
                <li>
                    <div class="item-inner">
                        <div class="item-title">
                            一级医院
                        </div>
                        <div class="item-center">
                            <input class="input-text form-control" id="level1" name="sfzh" type="text" placeholder="默认当前医生医院" value="" readonly
                                   quick-config="label:'身份证号', validateProxy:'notNull'">
                            <i class="iconfont icon-more"></i>
                        </div>
                    </div>
                </li>
                <li class="info" data-index="2">
                    <div class="item-inner">
                        <div class="item-title">
                            二级医院
                        </div>
                        <div class="item-center">
                            <input class="input-text form-control" id="level2" name="sj" type="text" placeholder="选择当前区县二级医院" value="" readonly
                                   quick-config="label:'手机', validateProxy:'notNull'">
                            <i class="iconfont icon-more"></i>
                        </div>
                    </div>
                </li>
                <li class="info" data-index="3">
                    <div class="item-inner">
                        <div class="item-title">
                            三级医院
                        </div>
                        <div class="item-center">
                            <input id="level3" class="input-text form-control" type="text"  placeholder="选择全市三甲医院" value="" readonly
                                   quick-config="label:'关系', validateProxy:'notNull'">
                            <i class="iconfont icon-more"></i>
                        </div>
                    </div>
                </li>
            </ul>
        </aside>

        </form>
     <button id="titleBtn" style="width: 100%;height:40px;color: #ffffff;border-radius: 5px;background-color: #AAB5F2;border: none;">提交</button>
    </section>
    <!--content end-->

</section>
</body>
</html>